package org.com.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.com.pojo.Categories;
import org.com.mapper.CategoriesMapper;
import org.com.service.CategoriesService;
import org.com.common.R;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
@Service
public class CategoriesServiceImpl extends ServiceImpl<CategoriesMapper, Categories>
    implements CategoriesService {

    @Override
    public R getAllCategories() {
        try {
            List<Categories> categories = this.list();
            return R.success("获取分类列表成功", categories);
        } catch (Exception e) {
            log.error("获取分类列表失败", e);
            return R.error("获取分类列表失败：" + e.getMessage());
        }
    }
} 